package com.chushouya.manager.dto.admin.log;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.general.framework.core.enums.BusinessStatus;
import com.general.framework.core.enums.ContextUserType;
import com.general.framework.core.lang.Dates;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@ApiModel("登录日志")
@Data
public class LoginLogListDTO {

    @ApiModelProperty("ID")
    private Long id;

    @ApiModelProperty("登录用户类型")
    private Integer userType;

    @ApiModelProperty("登录用户类型")
    private String userTypeName;

    @ApiModelProperty("用户名称")
    private String userName;

    @ApiModelProperty("登录IP地址")
    private String loginIp;

    @ApiModelProperty("登录地理位置")
    private String loginLocation;

    @ApiModelProperty("登录详情")
    private String loginDetail;

    @ApiModelProperty("状态")
    private Integer status;

    @ApiModelProperty("状态")
    private Integer statusDesc;

    @ApiModelProperty("提示消息")
    private String msg;

    @ApiModelProperty("登录时间")
    @JsonFormat(pattern = Dates.FMT_FULL_TIME)
    private Date loginTime;

    public String getStatusDesc() {
        return BusinessStatus.getDesc(this.status);
    }

    public String getUserTypeName() {
        return ContextUserType.getDesc(this.userType);
    }
}
